﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="ResearchList.aspx.vb" Inherits="myproject.ResearchList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            height: 186px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <p>
        <div>

        <table width="920" cellspacing="30" style="border-style: groove">
             
             <tr>
             <td class="style1">
             <h1 style="border-bottom-style: groove">Research List by Tags</h1>
             <br />
                 <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                     DataSourceID="TagsDataSource" HorizontalAlign="Center" AllowSorting="True">
                     <Columns>
                         <asp:HyperLinkField DataNavigateUrlFields="Tag" 
                             DataNavigateUrlFormatString="~/ResearchesWithTags.aspx?Tag={0}" 
                             DataTextField="Tag" HeaderText="Available Tags" />
                     </Columns>
                                 <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
        <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
        <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
        <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
        <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
        <SortedAscendingCellStyle BackColor="#F4F4FD" />
        <SortedAscendingHeaderStyle BackColor="#5A4C9D" />
        <SortedDescendingCellStyle BackColor="#D8D8F0" />
        <SortedDescendingHeaderStyle BackColor="#3E3277" />
                 </asp:GridView>
                 <asp:SqlDataSource ID="TagsDataSource" runat="server" 
                     ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                     ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
                     SelectCommand="SELECT Tag FROM Tags"></asp:SqlDataSource>
             </td>
             </tr>
             
             <tr>
             <td class="style1">
             <h1 style="border-bottom-style: groove">Research List</h1>
             <br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="ResearchListDataSource" Width="846px">
            <Columns>
                <asp:HyperLinkField DataNavigateUrlFields="ID" 
                    DataNavigateUrlFormatString="~/ResearchListDetails.aspx?ID={0}" 
                    DataTextField="Title" HeaderText="Title" />
                <asp:BoundField DataField="AddedBy" HeaderText="AddedBy" 
                    SortExpression="AddedBy" />
                <asp:BoundField DataField="University" HeaderText="University" 
                    SortExpression="University" /> 
                <asp:TemplateField HeaderText="Sample Picture">
                <ItemTemplate>
                <a href ='ResearchListDetails.aspx?ID=<%# Eval("ID") %>'>
                <img src ='<%# Eval("FirstPagePicture") %>' height ='200px' width ='200px' />
                </a>
                </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Rating">
                <ItemTemplate>
                <h2><%# doRating(Eval("Rating"))%></h2>
                </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
        <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
        <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
        <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
        <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
        <SortedAscendingCellStyle BackColor="#F4F4FD" />
        <SortedAscendingHeaderStyle BackColor="#5A4C9D" />
        <SortedDescendingCellStyle BackColor="#D8D8F0" />
        <SortedDescendingHeaderStyle BackColor="#3E3277" />
        </asp:GridView>
        <asp:SqlDataSource ID="ResearchListDataSource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
            
                     SelectCommand="SELECT [ID], [Title], [AddedBy], [University], [FirstPagePicture], [Rating] FROM [Researches]">
        </asp:SqlDataSource>
        </td> 
        </tr> 
        </table> 
        </div>
    </p>

</asp:Content>
